using System;
using System.Collections.Generic;
using System.Text;
using Zsa.Emulation.Input;

namespace Zsa.Emulation.Render.Input
{
    /// <summary>
    /// Base class for controller settings.
    /// </summary>
    public abstract class ControllerSettings : 
        RenderDeviceSettings<ControllerDeviceCapabilities,ControllerSettings,ControllerDeviceManager>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ControllerSettings"/> class.
        /// </summary>
        /// <param name="deviceItem">The device item.</param>
        protected ControllerSettings(RenderDeviceItem deviceItem)
            :base (deviceItem,RenderDeviceType.Input)
        {
        }




        private NesInputDeviceType _PlayerOneDeviceType = NesInputDeviceType.PortOne 
            | NesInputDeviceType.StandardController;

        private NesInputDeviceType _PlayerTwoDeviceType = NesInputDeviceType.PortTwo
            | NesInputDeviceType.StandardController;

        private NesInputDeviceType _PlayerThreeDeviceType = NesInputDeviceType.None;

        private NesInputDeviceType _PlayerFourDeviceType = NesInputDeviceType.None;

        public NesInputDeviceType PlayerOne
        {
            get
            {
                return _PlayerOneDeviceType;
            }
            set
            {
                _PlayerOneDeviceType = value;
            }
        }

        public NesInputDeviceType PlayerTwo
        {
            get
            {
                return _PlayerTwoDeviceType;
            }
            set
            {
                _PlayerTwoDeviceType = value;
            }
        }


        public NesInputDeviceType PlayerThree
        {
            get
            {
                return _PlayerThreeDeviceType;
            }
            set
            {
                _PlayerThreeDeviceType = value;
            }
        }


        public NesInputDeviceType PlayerFour
        {
            get
            {
                return _PlayerFourDeviceType;
            }
            set
            {
                _PlayerFourDeviceType = value;
            }
        }




        public bool IsFourPlayer
        {
            get
            {
                return (_PlayerOneDeviceType & NesInputDeviceType.FourPlayerAdaper) == NesInputDeviceType.FourPlayerAdaper;
            }
        }
    }
}
